import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/order_detail_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class OrderDetailEntity {
  late int code = 0;
  late String msg;
  late OrderDetailData data = OrderDetailData();

  OrderDetailEntity();

  factory OrderDetailEntity.fromJson(Map<String, dynamic> json) => $OrderDetailEntityFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailData {
  late String id;
  @JSONField(name: "order_no")
  late String orderNo;
  @JSONField(name: "user_id")
  late String userId;
  @JSONField(name: "address_snap")
  late OrderDetailDataAddressSnap addressSnap;
  late String status;
  late String remark;
  @JSONField(name: "store_id")
  late String storeId;
  @JSONField(name: "freight_price")
  late String freightPrice;
  @JSONField(name: "created_at")
  late String createdAt;
  late String integral;
  @JSONField(name: "pay_time")
  late String payTime;
  @JSONField(name: "all_company")
  late String allCompany;
  @JSONField(name: "all_company1")
  late String allCompany1;
  @JSONField(name: "all_money")
  late String allMoney;
  @JSONField(name: "all_money1")
  late String allMoney1;
  @JSONField(name: "goods_company")
  late String goodsCompany;
  @JSONField(name: "goods_company1")
  late String goodsCompany1;
  @JSONField(name: "goods_money")
  late String goodsMoney;
  @JSONField(name: "goods_money1")
  late String goodsMoney1;
  late String company;
  late String company1;
  late String money;
  late String money1;
  @JSONField(name: "cancel_minute")
  late String cancelMinute;
  late List<OrderDetailDataGoods> goods;
  @JSONField(name: "status_str")
  late String statusStr;
  @JSONField(name: "all_price")
  late String allPrice;
  late OrderDetailDataStore store;
  @JSONField(name: "delivery_time")
  late String deliveryTime;
  @JSONField(name: "confirm_time")
  late String confirmTime;
  late String tag;

  @JSONField(name: "store_express_money")
  late String storeExpressMoney;

  @JSONField(name: "is_show_notice_send")
  late String isShowNoticeSend = '';


  OrderDetailData();

  factory OrderDetailData.fromJson(Map<String, dynamic> json) => $OrderDetailDataFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataAddressSnap {
  late String id;
  late String address;
  late String username;
  late String mobile;

  OrderDetailDataAddressSnap();

  factory OrderDetailDataAddressSnap.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataAddressSnapFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataAddressSnapToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataGoods {
  late String id;
  @JSONField(name: "order_no")
  late String orderNo;
  @JSONField(name: "sku_id")
  late String skuId;
  @JSONField(name: "goods_id")
  late String goodsId;
  @JSONField(name: "sku_snap")
  late OrderDetailDataGoodsSkuSnap skuSnap;
  @JSONField(name: "buy_num")
  late String buyNum;
  @JSONField(name: "all_price")
  late String allPrice;
  @JSONField(name: "unit_price")
  late String unitPrice;
  @JSONField(name: "store_id")
  late String storeId;
  @JSONField(name: "created_at")
  late String createdAt;
  @JSONField(name: "updated_at")
  late String updatedAt;
  @JSONField(name: "area_type")
  late String areaType;
  @JSONField(name: "unit_integral")
  late String unitIntegral;
  @JSONField(name: "all_integral")
  late String allIntegral;
  @JSONField(name: "user_id")
  late String userId;
  late List<OrderDetailDataGoodsSpec> spec;
  late String company;
  late String company1;
  late String money;
  late String money1;
  @JSONField(name: "status_detail")
  late String statusDetail;


  OrderDetailDataGoods();

  factory OrderDetailDataGoods.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataGoodsFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataGoodsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataGoodsSkuSnap {
  late String id;
  @JSONField(name: "goods_id")
  late String goodsId;
  @JSONField(name: "spec_key")
  late List<String> specKey;
  @JSONField(name: "spec_val")
  late List<String> specVal;
  @JSONField(name: "img_path")
  late String imgPath;
  late String price;
  late String integral;
  late String stock;
  late OrderDetailDataGoodsSkuSnapGoods goods;

  OrderDetailDataGoodsSkuSnap();

  factory OrderDetailDataGoodsSkuSnap.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataGoodsSkuSnapFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataGoodsSkuSnapToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataGoodsSkuSnapGoods {
  late String id;
  late String name;
  @JSONField(name: "store_id")
  late String storeId;
  @JSONField(name: "area_id")
  late String areaId;

  OrderDetailDataGoodsSkuSnapGoods();

  factory OrderDetailDataGoodsSkuSnapGoods.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataGoodsSkuSnapGoodsFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataGoodsSkuSnapGoodsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataGoodsSpec {
  late String name;
  late String val;

  OrderDetailDataGoodsSpec();

  factory OrderDetailDataGoodsSpec.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataGoodsSpecFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataGoodsSpecToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class OrderDetailDataStore {
  late String id;
  late String logo;
  late String name;
  late String contact;

  OrderDetailDataStore();

  factory OrderDetailDataStore.fromJson(Map<String, dynamic> json) =>
      $OrderDetailDataStoreFromJson(json);

  Map<String, dynamic> toJson() => $OrderDetailDataStoreToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
